﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ProductIntory.Infrastructures.Migrations
{
    /// <inheritdoc />
    public partial class 读取1002 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ProductAttributes");

            migrationBuilder.DropTable(
                name: "ProductInspection");

            migrationBuilder.DropTable(
                name: "ProductionStorage");

            migrationBuilder.DropTable(
                name: "Products");

            migrationBuilder.DropTable(
                name: "ProductStates");

            migrationBuilder.DropTable(
                name: "ProductTypes");

            migrationBuilder.DropTable(
                name: "SalesOrderModel");

            migrationBuilder.DropTable(
                name: "SalesOutboundTable");

            migrationBuilder.DropTable(
                name: "Useres");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "ProductAttributes",
                columns: table => new
                {
                    ProductAttributeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductAttributeName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductAttributes", x => x.ProductAttributeId);
                });

            migrationBuilder.CreateTable(
                name: "ProductInspection",
                columns: table => new
                {
                    ProductsInspection_Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CriticalDefect = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ErrorLowerLimit = table.Column<int>(type: "int", nullable: true),
                    ErrorUpperLimit = table.Column<int>(type: "int", nullable: true),
                    InspectionItemCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    InspectionItemName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Isdel = table.Column<bool>(type: "bit", nullable: true),
                    MinorDefect = table.Column<int>(type: "int", nullable: true),
                    Remark = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SeriousDefect = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductInspection", x => x.ProductsInspection_Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductionStorage",
                columns: table => new
                {
                    Productionstorage_ID = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BatchNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDel = table.Column<bool>(type: "bit", nullable: true),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProductNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SpecificationModel = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StorageOrderName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StorageOrderNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StorageQuantity = table.Column<int>(type: "int", nullable: true),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    WorkOrderNumber = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductionStorage", x => x.Productionstorage_ID);
                });

            migrationBuilder.CreateTable(
                name: "Products",
                columns: table => new
                {
                    Productions_Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BOMCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CurrentStock = table.Column<int>(type: "int", nullable: true),
                    Isdel = table.Column<bool>(type: "bit", nullable: true),
                    ProductAttribute = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProductCategory = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProductCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ProductType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    StockUpperLimit = table.Column<int>(type: "int", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Products", x => x.Productions_Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductStates",
                columns: table => new
                {
                    ProductStateId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductStateName = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductStates", x => x.ProductStateId);
                });

            migrationBuilder.CreateTable(
                name: "ProductTypes",
                columns: table => new
                {
                    ProductType_Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductTypeName = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductTypes", x => x.ProductType_Id);
                });

            migrationBuilder.CreateTable(
                name: "SalesOrderModel",
                columns: table => new
                {
                    SalesOrderId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ClientId = table.Column<int>(type: "int", nullable: false),
                    ContractId = table.Column<int>(type: "int", nullable: false),
                    CreatTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    IsDel = table.Column<bool>(type: "bit", nullable: false),
                    SaleNumder = table.Column<int>(type: "int", nullable: false),
                    SalesOrderCode = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SalesOrderModel", x => x.SalesOrderId);
                });

            migrationBuilder.CreateTable(
                name: "SalesOutboundTable",
                columns: table => new
                {
                    Salesoutboundtable_Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CustomerName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ExpiryDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    OutboundOrderCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    OutboundOrderName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductionDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Specification = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Status = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Unit = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SalesOutboundTable", x => x.Salesoutboundtable_Id);
                });

            migrationBuilder.CreateTable(
                name: "Useres",
                columns: table => new
                {
                    UId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Department_Id = table.Column<int>(type: "int", nullable: true),
                    Login_Number = table.Column<int>(type: "int", nullable: true),
                    Real_Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Role_Id = table.Column<int>(type: "int", nullable: true),
                    User_Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    User_FixedPhone = table.Column<int>(type: "int", nullable: true),
                    User_IsDel = table.Column<bool>(type: "bit", nullable: true),
                    User_Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    User_PassWord = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    User_Phone = table.Column<int>(type: "int", nullable: true),
                    User_WorkCode = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Useres", x => x.UId);
                });
        }
    }
}
